<?php $this->_extends('_layouts/main_layout'); ?>

<?php $this->_block('title'); ?>
<?php
if (!empty($_SESSION['ga_title']))
{
	echo $_SESSION['ga_title'];
}
else{
	echo 'Free Games, Free Online Games, Free Online Casual Games with Cash Prizes - CashDazzle Cash Wheel Game';
}
?>
<?php $this->_endblock(); ?>

<?php $this->_block('keywords');?>
<meta name="keywords" content="<?php echo $site['keywords']; ?>" />
<?php $this->_endblock();?>

<?php $this->_block('description');?>
<meta name="description" content="CashDazzle: one of the world's leading casual gaming communities. Free online games with real cash prizes. Spin the wheel and get chances to win cash prizes. Prizes awarded daily and its free to play. Sign up and play today the CashDazzle Cash Wheel Game!" />
<?php $this->_endblock();?>

<?php $this->_block('content'); ?>
<?php if(!empty($x)):?>
<script src="<?php echo $js_url; ?>jquery.scrollTo-min.js" type="text/javascript" ></script>
<script type="text/javascript">
window.innerHeight = 581;
window.innerWidth = 800;
window.moveTo(<?php echo $x;?>, <?php echo $y;?>);
(function($){$(window).scrollTo({top:300,left:400});})(jQuery);
window.location.hash = "game";
</script>
<?php endif;?>
	
	<?php
		if(isset($_SESSION['ga_title'])):
	?>
		<div class="mt">
			<?php $this->_element('social');?>
		</div>
		<div class="mm help" style="margin-top:5px;color:white;">
			<div class="title">Thank you! You Have Received Your FREE Spin!</div>
			<p style="font-weight:600;font-size:14px;">
				We have sent you a welcome e-mail. Please go to your mailbox, complete your registration, and receive another FREE spin today! To ensure you receive our emails in your inbox (not a bulk folder), add no-reply@cashdazzle.com to your address book. 
			</p>
			<p style="font-weight:600;font-size:14px;">
				Now continue playing the game by spinning the wheel below. When you run out of spins, participate in our sponsored offers to receive more spins. Good luck!
			</p>
		<div class="clear" style="height: 10px"></div>
		</div>
	<?php 
			unset($_SESSION['ga_title']);
		elseif(!empty($user)):
	?>
	<div class="mt">
		<?php $this->_element('social');?>
	</div>
	<div class="mm help" style="margin-top:5px;color:white;padding-bottom:0">
	<?php if($user['credit']<1):?>
		<div class="title" style="color:yellow;">Get Another Spin Now!</div>
			<hr/>
		<p style="font-weight:700;font-size:16px;">
			You can get more spins by participating in the offers from our sponsors. Our sponsors keep CashDazzle 
			FREE and they pay for the cash prizes. check out  <a href="<?php echo url('offer/morecredit'); ?>" style="color:white">Get More Spins</a>.
		</p>
	<?php else:?>
		<div class="title" style="color:yellow;">Spin the wheel now!</div>
			<hr/>
		<p style="font-weight:700;font-size:16px;" id="hint">
			You have spins! Each spin is a chance to win the jackpot and other prizes! When your account balance reaches $20, you can request a cash out. Keep playing and winning!
		</p>
	<?php endif;?>
	<div class="topad">
		<?php if (!empty($user)) { ?>
		<?php echo str_replace('[[USER_ID]]', $user['id'], $site['ad_top']);?>
		<?php } ?>
	</div>
	<div class="clear" style="height: 10px"></div>
	</div>
	<?php else:?>
	<div class="clear" style="height:3px;"></div>
	<div id="congratulations">
			<?php $this->_element('social');?>
			<div class="clear"></div>
			<div class="playnow left white">
				<?php 
					if(empty($user) && isset($_SESSION['PLAYED'])):
				?>
				<div class="clear" style="height:37px;"></div>
				<div class="win1" style="padding-top:20px"><img width="307" height="305" alt="" src="<?php echo $img_url;?>youjustwon.png"></div>
				<!-- 
				 -->
				<?php else :?>
				<div class="clear" style="height: 57px;"></div>
				
					<div class="win"><img src="<?php echo $img_url; ?>playnow.png" alt="" width="252" height="41" /></div>
					<div class="txt1">Spin the wheel to win cash prizes.<br />
						Play everyday, and it's FREE to play! <br />
						Get started by clicking "Click Here" on the <br />
						cash wheel below to play NOW!
					</div>
				<?php endif;?>
			</div>
			<div class="join right white">
				<div class="clear" style="height:102px"></div>
				<div>1. Chance to win money!</div>
				<div>2. Have fun and join a community</div>
				<div>3. It's <span class="yellow">FREE</span></div>
				<div class="signup"><a href="<?php echo url('user/register'); ?>"><img src="<?php echo $img_url; ?>signup.png" alt="" width="158" height="58" /></a></div>
			</div>
			<div class="clear" style="height:8px;" id="separator"></div>
			<?php 
				if(empty($user) && isset($_SESSION['PLAYED'])):
			?>
			<div class="mm help" style="width:750px;margin-left:0">
				<div class="txt white" style="font-size:17px;font-weight:700;">
					Create a FREE account to keep your $1.00 and to receive your next FREE spin. Every play is a chance to win more cash prizes.
				</div>
				<div style="text-align:center;margin-top:10px;">
					<a href="<?php echo url('user/register');?>">
						<img width="411" height="51" alt="" src="<?php echo $img_url; ?>createaccountbtn-1.png">
					</a>
				</div>
			</div>
			<?php endif;?>
	</div>
	<?php endif; ?>
	<div class="clear" style="height: 10px"></div>
	<div class="game" id="game">
		<?php $this->_element('wheel_body'); ?>	
	</div>
	<div class="social_tags" style="float:right;padding:20px 25px 0 0">
		<!--  facebook like button -->
		<div id="fb-root"></div>
		<script src="http://connect.facebook.net/en_US/all.js"></script>
		<script>(function(d, s, id) {
		  var js, fjs = d.getElementsByTagName(s)[0];
		  if (d.getElementById(id)) {return;}
		  js = d.createElement(s); js.id = id;
		  js.src = "//connect.facebook.net/en_US/all.js#appId=<?php echo $fbsocials['appId'];?>&xfbml=1";
		  fjs.parentNode.insertBefore(js, fjs);
		}(document, 'script', 'facebook-jssdk'));
		</script>
		<fb:like send="false" width="250" show_faces="false"></fb:like>
	</div>
	<div style="clear:both"></div>
	
	<?php if(isset($showMaumdu) && $showMaumdu == true): ?>
		<!-- maudau code begin -->
		<iframe id="maudauIframe" scrolling="no" height="72" frameborder="0" width="100%" marginheight="0" marginwidth="0" src="//www.maudau.com/AdsBar/?appid=1884"></iframe>
		<!-- maudau code end -->
	<?php endif; ?>

	<?php if(isset($_SESSION[Q::ini('acl_session_key')]) && $user['credit']<1): ?>
		<script type="text/javascript">
			setTimeout("window.location.href ='<?php echo url('offer/morecredit');?>';", 10000);
		</script>
	<?php endif; ?>

<script type="text/javascript">
function beforePlay(credit)
{
	$('#current_credits').html(credit);
}
function afterPlay(cash, credit, jackpot){
	loginned=<?php echo isset($user) ? 1 : 0;?>;
	if(loginned){
		changeCurrentUserState(cash, credit);
		if(credit==0){
			$('.have').hide();
			$('.title').fadeOut().html('You Have No Spins!').fadeIn('slow');
			$('#hint').fadeOut().html('Get more spins now. You can get more spins by participating in the offers from our sponsors. Our sponsors help keep CashDazzle FREE and increase our jackpot every time someone in our community signs-up. Check out  <a href="<?php echo url('offer/morecredit'); ?>" style="color:#9BEF23">Get More Spins</a>.').fadeIn('slow');
			$('#credit-tip').show();
		}
	}else{
		won1CreateNew();
	}
	changeJackpotState(jackpot);
}
function changeCurrentUserState(cash, credit){
	$('#current_balance').html('$'+cash);
	$('#current_credits').html(credit);
	$('#current_balance').animate({fontSize:"30px"}, 'slow').animate({fontSize:"12px"}, 'slow');
}
function won1CreateNew(){
	$('.playnow').children(':gt(0)').remove();
	$('#congratulations').animate({height:"40px"}, 'slow',  function(){
		var pic = '<div class="win1" style="padding-top:20px"><img width="307" height="305" alt="" src="<?php echo $img_url;?>youjustwon.png"></div>';
		$('.social').before(pic);
		var account = '<div class="mm help" style="width:750px;margin-left:0"><div class="txt white" style="font-size:17px;font-weight:700;">Welcome to Cash Dazzle. Create your FREE account to keep your $1.00 and continue playing our game. Register now and we will give you another FREE spin. Every spin is a chance to win more cash prizes! </div><div style="text-align:center;margin-top:10px;position:relative;"><div id="reg-tip" style="width:<?php echo $tips['reg-tip']['tip_width'] ?>; position:absolute; left:160px; top:55px; border:solid 2px #FFF; background-color:<?php echo $tips['reg-tip']['bg_color'] ?>"><div style="color:#FFF; position:absolute; left:190px; top:-10px; font-size:16px;">◆</div><div style="color:<?php echo $tips['reg-tip']['bg_color']; ?>; position:absolute; left:190px; top:-8px; font-size:16px;">◆</div><p style="margin:<?php echo $tips['reg-tip']['tip_padding'] ?>; font-size:<?php echo $tips['reg-tip']['font_size'] ?>; font-weight:bolder; color:<?php echo $tips['reg-tip']['font_color'] ?>; line-height:<?php echo $tips['reg-tip']['tip_lineheight'] ?>; height:<?php echo $tips['reg-tip']['tip_height'] ?>; "><?php	echo $tips['reg-tip']['tip_text']; ?></p></div><a href="<?php echo url('user/register');?>"><img width="411" height="51" alt="" src="<?php echo $img_url; ?>createaccountbtn-1.png"></a></div></div>';
		$('#separator').after(account);
		$('#new_account').hide().show('slow');
	});
	$('#congratulations').animate({height:"370px"}, 'slow');
}
function changeJackpotState(jackpot){
	var jackpotStr = jackpot.toFixed(2) + '';
	var jack = jackpotStr.split('.');
	$('.jackpot').children(':gt(0)').remove();
	var jPics = '';
	for(i=0;i<jack[0].length;i++){
		jPics += '<img alt="" src="<?php echo $img_url;?>' + jack[0][i] + '.png">';
	}
	jPics += '<img alt="" src="<?php echo $img_url;?>point.png">';
	for(i=0;i<jack[1].length;i++){
		jPics += '<img alt="" src="<?php echo $img_url;?>' + jack[1][i] + '.png">';
	}
	$('.jackpot').append(jPics);
}
</script>
<!-- Start Quantcast Tag -->
<script type="text/javascript"> 
_qoptions={qacct:"p-006GF_oN2DAeg",labels:"_fp.channel.Cash Dazzle,_fp.event.Cash Dazzle Homepage"};
</script>
<script type="text/javascript" src="http://edge.quantserve.com/quant.js"></script>
<noscript>
<img src="http://pixel.quantserve.com/pixel/p-006GF_oN2DAeg.gif?labels=_fp.channel.Cash+Dazzle,_fp.event.Cash+Dazzle+Homepage" style="display: none;" border="0" height="1" width="1" alt="Quantcast"/>
</noscript>
<!-- End Quantcast tag -->
<script src="http://action.media6degrees.com/orbserv/hbjs?pixId=7393&pcv=58" type="text/javascript"></script>

<script type="text/javascript">
var PeanutLabsPre = (("https:" == document.location.protocol) ? "https://ssl-" : "http://");
document.write(unescape("%3Cscript src='" + PeanutLabsPre + "astatic.peanutlabs.com/js/alert/main.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<?php if (!empty($user)) {?>
<script type="text/javascript">
try{
var args = {
userId:"<?php echo $user['id'].'-4676-'.substr(md5($user['id'].'4676'.'f211973200aed87ef558d3ec364765dc'), 0, 10 );?>", // Replace #userId# with your visitor's Peanut Labs userId
iframeURL:"http://www.cashdazzle.com/morecredit", // Replace with URL for where you've embedded IFRAME
position_ver:"bottom", //or "top"
position_hor:"right", //use left to show it on the left
hideTimer:"true"
};
peanut.initialize(args);
}
catch(e){}
</script>
<?php 
}
else
{?>
<script type="text/javascript" src="http://pixel.sitescout.com/ap/50a9c1838e6514c2"></script>
<?php } ?>
<?php $this->_endblock('contents'); ?>